<?php
/**
 * Created by PhpStorm.
 * User: zhu_hbo
 * Date: 16/10/9
 * Time: 上午9:28
 */

?>

<html>
<body>

<form method="post" action="<?php echo $_SERVER['PHP_SELF'];?>">
    Name: <input type="text" name="fname">
    <input type="submit">
</form>

<?php
$name = $_POST['fname'];
echo $name;
?>

</body>
</html>
